<?php
	session_start();
	/*if(!isset($_SESSION['username'])){
		header('Location: index.php');
		exit();
	}*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1251">
<title>Add tractor</title>
</head>
<body>
    <?php
    if(isset($_POST['add_tractor'])){
    	
		$model = $_POST['model'];
		$price = $_POST['price'];
			
		$db_connect = mysqli_connect("localhost", "root", "root", "tractor");
		$query = "INSERT into producer(model, price)
						VALUES('$model', '$price')";
		$result = mysqli_query($db_connect, $query) or die(mysqli_error($db_connect));
		mysqli_close($db_connect);
		header('Location: main.php');
    }
	?>
	<form method="post">
	<table>
		<tr><td>Model:</td><td><input type="text" name="model"/></td></tr>
		<tr><td>Price:</td><td><input type="text" name="price"/></td></tr>
		<tr><td><input type="submit" name="add_tractor" value="Add tractor"/></td></tr>
	</table>
	</form>
</body>
</html>